Comparing Producer-Consumer Implementations in Go, Rust, and C
نویسندگان
چکیده
The producer-consumer model is a classic synchronization problem, exploring the division of labor between threads. Producers are responsible for creating or yielding items of some kind, while consumers are responsible for processing these items. The producer-consumer model is present in a wide array of multithreaded applications. It is commonly used to read data from high-throughput streaming APIs, and underlies the design of popular streaming data services such as RabbitMQ and Apache Kafka. Producer-consumer is a model frequently used in other data-intensive tooling, frequently appearing in any tooling used to ingest and process large quantities of data. Given the prevalence of the producer-consumer model, we sought to examine implementations of this model across systems programming languages. The producer-consumer model offered a valuable opportunity to explore and compare concurrency tools among systems languages, and implementing producer-consumer in multiple languages could reveal the utility of using certain languages for data-intensive processing. In our research, we seek to answer two questions: (1) how did concurrency tools such as threads and shared/concurrent queues broadly differ across systems languages and (2) how did ease of implementation and performance compare between these languages? In this paper, we implement and benchmark producer-consumer models in the increasingly prominent systems languages Go and Rust, in addition to the mainstay language C. We analyze the ease of writing multithreaded code in these languages, and the subsequent performance of our implementations on common producer-consumer use cases. Our code can be found in our GitHub repo at https://github.com/gabbifish/producer-consumer.
منابع مشابه
NEW RECORDS FOR IRANIAN RUST FLORA FROM THE GO LEST AN NATIONAL PARK (NE IRAN)
Based on the floristic study of rust fungus flora (Uredinales) ofGolestan National Park, located in the Northeast of Iran, 68 rust taxa were recognized. Of these, one subspecies and five species viz. Phragmidium sanguisorbae subsp. mediterraneum on Sanguiosorba minor, Puccinia difformis on Galium aparine, P. jasmini on Jasminum fruticans, P. rhylismoides on Thalictrum isopyroides, Uromyces mogi...
متن کاملSupply Chain Analysis of Fresh Guava ( A Case Study )
The present study was focused on supply chain analysis of fresh guava in order to evaluate existing marketing supply chains (SC1: Producer - Consumer, SC2: Producer - Retailer - Consumer, SC3: Producer - Commission agent - Retailer - Consumer, SC4: Producer - Commission agent - Wholesaler - Retailer - Consumer) for two variety (allahabad safeda and apple guava) of guava. The gross marketing pri...
متن کاملDiesel price convergence and mineral oil taxation in Europe
We empirically analyze convergence of European producer and consumer prices for diesel fuel and investigate the role of excise taxation. By comparing the speed of convergence of prices and taxes we find a surprisingly fast speed of convergence for consumer prices. While this can in part be explained by fuel tourism, the main driving force is producer price dynamics. Tax convergence contributes ...
متن کاملScalable Producer-Consumer Pools Based on Elimination-Diffraction Trees
Producer-consumer pools, that is, collections of unordered objects or tasks, are a fundamental element of modern multiprocessor software and a target of extensive research and development. For example, there are three common ways to implement such pools in the Java JDK6.0: the SynchronousQueue, the LinkedBlockingQueue, and the ConcurrentLinkedQueue. Unfortunately, most pool implementations, inc...
متن کاملProof-Carrying Code with Untrusted Proof Rules
Proof-carrying code (PCC) allows a code producer to associate to a program a machine-checkable proof of its safety. In traditional implementations of PCC the producer negotiates beforehand, and in an unspecified way, with the consumer the permission to prove safety in whatever high-level way it chooses. In practice this has meant that highlevel rules for type safety have been hard-wired into th...
متن کامل